<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-L-admin1.0</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" href="../css/font.css">
        <link rel="stylesheet" href="../css/xadmin.css">
        <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>

    </head>
    <body>
    <div class="x-body layui-anim layui-anim-up">
        <blockquote class="layui-elem-quote">欢迎<span id="type"></span>：
            <span class="x-red" id="name">test</span>！当前时间:<span id="date">2018-04-25 20:50:53</span>
        </blockquote>
    </div>
   
    </body>
<script>
    //获取当前日期函数
    function getNowFormatDate() {
        let date = new Date(),
            obj = {
                year: date.getFullYear(), //获取完整的年份(4位)
                month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
                strDate: date.getDate(), // 获取当前日(1-31)
                week: '星期' + '日一二三四五六'.charAt(date.getDay()), //获取当前星期几(0 ~ 6,0代表星期天)
                hour: date.getHours(), //获取当前小时(0 ~ 23)
                minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
                second: date.getSeconds() //获取当前秒数(0 ~ 59)
            }

        Object.keys(obj).forEach(key => {
            if (obj[key] < 10) obj[key] = `0${obj[key]}`
            // console.log(obj[key])
        })

        return `${obj.year}年${obj.month}月${obj.strDate}日 ${obj.week} ${obj.hour}:${obj.minute}:${obj.second}`
    }
    window.onload=function () {

        $.ajax({
            url:'/course/getSession',
            success:function (res) {
                $('#type').html(`${res.data.type}`)
                $('#name').html(`${res.data.data.name}`)
                $('#date').html(`${getNowFormatDate()}`)
            }
        })
    }
</script>
</html>